package cms.controller;

import cms.entity.User;
import cms.service.testLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


import java.util.ArrayList;
import java.util.List;

@Controller
public class test {


/*    @RequestMapping(value="/test")
    @ResponseBody
    public List<User> test(){
        User u1=new User();
        u1.setName("test1");
        u1.setEmail("test1@");


        User u2=new User();
        u2.setName("test2");
        u2.setEmail("test2@");

        List<User> list=new ArrayList<User>();
       *//* ModelAndView mv=new ModelAndView();
        mv.setViewName("test");
        mv.addObject("u",u);*//*

       list.add(u1);
       list.add(u2);
        System.out.println("Access-----------------------------");
        return list;
    }*/

   @Autowired
   private testLoginService testLoginService;


    @RequestMapping(value="/test")
    @ResponseBody
    public List<User> test(){

        List<User> list=testLoginService.listUser();

        System.out.println("Access '/test.do'-----------------------------");
        return list;
    }



}
